home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 347_01.zip / TAVLPRED.C < prev    next >
C/C++ Source or Header  |  1993-04-13  |  708b  |  33 lines

  1. /*:file:version:date: "%n    V.%v;  %f"
  2.  * "TAVLPRED.C    V.8;  27-Apr-91,12:07:34"
  3.  *
  4.  *  Purpose: Return a pointer to the in-order predeccessor of
  5.  *           the node "p"
  6.  *
  7.  *  Released to the PUBLIC DOMAIN
  8.  *
  9.  *              author:     Bert C. Hughes
  10.  *                          200 N.Saratoga
  11.  *                          St.Paul, MN 55104
  12.  *                          Compuserve 71211,577
  13.  */
  14.  
  15. #include "tavltree.h"
  16. #include "tavlpriv.h"
  17.  
  18. TAVL_nodeptr tavl_pred(TAVL_nodeptr p)
  19. {
  20.     register TAVL_nodeptr q;
  21.  
  22.     if (!p)
  23.         return NULL;
  24.  
  25.     q = p->Lptr;
  26.  
  27.     if (LLINK(p))
  28.         while (RLINK(q))
  29.             q = q->Rptr;
  30.  
  31.     return (Is_Head(q) ? NULL : q);
  32. }
  33.